1. Field of the Invention
One or more aspects of the present invention generally relate to computer graphics and, more particularly, to rendering three-dimensional (3D) scenes with depth-of-field correction.
2. Description of the Related Art
In general, three-dimensional (3D) computer graphics is the art and science of generating 3D scenes on a two-dimensional (2D) computer screen. In a 3D animation, a sequence of images is displayed, giving the appearance of motion in three-dimensional space. Interactive 3D computer graphics allows a user to change viewpoint or geometry in real-time, thereby requiring the graphics system to create new images. Conventionally, the higher the number of images that are displayed per second, commonly referred to as the frame rate, the smoother the animation will appear but the more processing power and system bandwidth is required. For example, the human eye may detect new images coming onto the screen at frame rates less than 30 frames per second (fps). Several factors may affect the actual frame rate on a computer graphics system, such as the number of pixels on the screen. Generally, higher frame rates are possible with a lower number of pixels, but visually perceptible image quality may suffer.
While the number of pixels and frame rate is important in determining graphics system performance, visual quality of the image generated may be equally important. For example, an image on a 2D screen with a high pixel density may still appear unrealistic if all the objects appearing in the scene are in focus. The unrealistic appearance is due to an incorrect (or lack of) depth-of-field effect of the image. Depth of field generally refers to the distance range (i.e., an in-focus range) from a viewpoint within which objects in an image look sharp. In general, depth-of-field corrections attempt to blur objects or areas of an image that are either closer or farther away from a particular focal point.
FIG. 1 illustrates an exemplary field of view 100 having an in-focus region 112 and out-of-focus regions 114 in the foreground and background. As used herein, the terms foreground and background refer to regions or objects nearer to or farther from, respectively, a viewpoint relative to a reference region or object. As illustrated, out-of-focus regions 114 typically transition from in-focus to out-of focus. In general, the greater the distance from the in-focus region 112, the less sharp an object will appear. In other words, an image of the field of view 100 displayed on a 2D screen may appear more realistic if in-focus objects 122 and 124 appear sharp, a slightly out-of-focus object 126 appears slightly blurred and an out-of-focus object 128 appears very blurred. Accordingly, depth-of-field corrections applied to a 3D scene rendered on a 2D screen may enhance the quality of the image by adding realism.
Traditional approaches to performing depth-of-field corrections on a 3D scene typically perturb (i.e., jitter) a viewpoint multiple times, rendering the scene for each perturbation. The rendered scenes for each of the perturbations are accumulated in an accumulation buffer. After all the perturbations, the final scene in the accumulation buffer (possibly after some filtering) may be transferred to a frame buffer. The concept is that, by perturbing the viewpoint, objects that are in focus should remain in focus, while objects that are out of focus should change with each perturbation. The final accumulated values for pixels of out-of-focus objects should be a sum of the value of neighboring pixels offset by a distance determined by the perturbations. Accordingly, out-of-focus objects should appear blurry in the final scene. Another approach to depth of field effects is achieved by randomizing sample locations, as described in U.S. Pat. No. 4,897,806.
However, all these previous approaches conventionally require that the scene be rendered numerous times (or, the rendering to have many more samples per pixel) to achieve acceptable image quality. As a result, the processing time required to achieve acceptable image quality using these approaches may lower the frame rate of the graphics system to an unacceptable level. Therefore, these conventional approaches to depth-of-field corrections may be unsuitable for real time 3D graphics processing systems.
Accordingly, a need exists for improved rendering of 3D scenes with depth-of-field effects, namely, where less processing time is used.